package com.icss.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.icss.dao.PurchaseDao;
import com.icss.dao.staffDao;
import com.icss.entity.Purchase;
import com.icss.entity.staff;
@Controller
public class staff_controller {
	@Autowired staffDao dao;
	@RequestMapping("insertstaff")
	public String fun3(int role_id,String staff_name,int staff_salary){
		int r=dao.addstaff( role_id, staff_name, staff_salary);
		return "redirect:showstaff.do";
	}
	@RequestMapping("showstaff")
	public String fun4(ModelMap map){
		List<staff> list=dao.staffs();
		map.addAttribute("staffList", list);
		return "stuffManage";
		
	}
	@RequestMapping("updates")
	public String fun4(ModelMap map,Integer staff_id){
		List<staff> list=dao.updates(staff_id);
		map.addAttribute("staffList", list);		
		return "updatestaff";
		}
	@RequestMapping("updatestaff")
	public String fun5(ModelMap mp,int staff_salary,int staff_id ){
		int r=dao.updatestaff(staff_salary, staff_id);
		return "redirect:showstaff.do";}
@RequestMapping("deletestaff")
public String fun6(int staff_id ){
	int r=dao.deletestaff(staff_id);
	return "redirect:showstaff.do";}

}